<!DOCTYPE HTML>
<html>
  <head>
    <title>Events</title>
        <link type = "image/x-icon" rel="SHORTCUT ICON" href="img/favicon.ico" />	
        <script type="text/javascript" src="jquery/jquery-1.7.1.min.js"></script>     
		<link rel="stylesheet" href="css/style.css" />
        <link rel="stylesheet" href="css/grid-12.css" />

        
  </head>
  <body>
    <div id="container" class="container_12">
    
    <?php
    include("inc/db.class.php");
		require("php/header.php");
		include("inc/functions.php");
		?>
      <div id="line" class="grid_12"></div>
			<div id="" class="grid_12">
				<h3>Events</h3>
<?php 
require('connection.php');

$query = "select * from events order by modified_at desc";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
	//$date = new DateTime();
	//$date->setTimestamp($row['start_date']);
	//$start_time = $date->format('Y-M-d H:i');
	
	$start_time = date('l jS F Y', strtotime($row['start_date']));
	$end_time = date('l jS F Y', strtotime($row['end_date']));
	//$start_time = $date->format('l jS F Y');
	//$date->setTimestamp($row['end_date']);
	//$end_time = $date->format('Y-M-d H:i');

	
	
	echo '<div class="event-list">
				<div class="levels"></div><div><h3>'.$row['title'].'</h3></div>
				<div class="levels"></div><div>'.$row['description'].'</div>
				<div class="levels">When :</div><div>'.$start_time.'</div>
				<div class="levels">Duration</div><div>'.duration($row['start_date'],$row['end_date']).'</div>
				<div class="levels">Venue:</div><div>'.$row['venue'].'</div>
			<div class="clear"></div>
         </div>';
	  
         echo '<div class="clear"></div>';
}
?>
			</div>
						
			<?php require("php/footer.php"); ?>
    </div>
  </body>
</html>
